package edu.cornell.cubooks.domain;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * The Business object which represents feedback.
 * 
 * @author CUBooks Team
 *
 */
@Entity
@Table(name="feedback")
public class Feedback implements Serializable {
	private static final long serialVersionUID = -7113449011336231406L;
	
	@Id 
    @GeneratedValue
	private Integer id;
	private Integer rate;
	private String description;
	
	// one feedback belongs to one posting
	@OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name="posting_id")
    public Posting posting;
    
    // many feedbacks belong to one user
    @ManyToOne
    @JoinColumn(name="user_id")
    public User user;

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Posting getPosting() {
		return posting;
	}

	public void setPosting(Posting posting) {
		this.posting = posting;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}


	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}
}
